﻿using System.Collections.Generic;
using System.Linq;
using eCommMongo.Core.Domain.Products;
using eCommMongo.Service.Shops;

namespace eCommMongo.Service.Products
{
    public class ProductMapper
    {
        public static IList<Product> ToProducts(IList<Product> products)
        {
            return products.Select(ToProduct).ToList();
        }

        //public static ProductVariant ToProductVariant(ProductVariant p)
        //{
        //      return new ProductVariant()
        //        {
        //            Id = p.Id,
        //            ProductId = p.ProductId,
                   
        //            Name = p.Name,
        //            Sku = p.Sku,
        //            Price  = p.Price,
        //            DisplayOrder = p.DisplayOrder,
        //            StockQuantity = p.StockQuantity,
        //            Product = new Product()
        //                {
        //                    Deleted = p.Product.Deleted,
        //                    Published = p.Product.Published,
        //                    Id =p.Product.Id,
        //                    ProductName = p.Product.ProductName,
        //                    ShortDescription = p.Product.ShortDescription,
        //                    FullDescription = p.Product.FullDescription,
        //                },

        //            ProductVariantAttributes = ToProductVariantAttributes(p.ProductVariantAttributes),
        //            Published = p.Published,
        //            Deleted = p.Deleted,
        //            PictureId = p.PictureId,
        //        };
        //}

        public static Product ToProduct(Product p)
        {
            p.Shop = ShopMapper.ToShop(p.Shop.Id);
            return p;
        }


        

        

       
    }
}